
\subsection{Problem 5}

Recommended (8 Points): Assume that your goal was to find out the WCET of task.c:task(). Before
analyzing the execution time, you should answer a few basic questions about the input data for the monitoring task, and analyze the control flow on the source code level. What is the set of input data which might influence the execution time of the task at the software side? Is it tractable to enumerate every possible input? Which loops need to be bounded? Add all loop bounds and flow facts you can find to the file task.c (as source code annotations).
\\
\\
\textbf{Solution:}
\\
\\
You can find the source code of \textit{task.c} in Section~\ref{sec:task} with all source code annotations and loop bounds. We added 1 loop bound to the function \textit{check\_square}, 1 loop bound to the function \textit{check\_sin}, 3 loop bounds to the function \textit{merge\_samples}, 4 loop bounds to the function \textit{fft} and 3 loop bounds to the function \textit{fp\_radix2fft\_withscaling}. We bounded all loops in the software.
\\
In general it is a huge effort to enumerate over all possible inputs and look for the WCET. In this example it is intractable. The static analysis yields all necessary information to give an estimation about the WCET. It must be done very carefully. Some bounds may be overlooked very easily. One has to understand the source code completely.
\\
The execution of the software is influenced on how the relation between valid and missing samples is. The software interpolates a maximum of 4 missing samples between valid samples. To get the WCET we have to make sure that there are a lot of missing samples in the buffer. So there should always be a valid sample followed by 4 missing samples. This would yield in our opinion the WCET of the software.

